<!-- 制造令信息 -->
<div class="open-form">
    <div class="open-model">
        <div class="open-auto">
            <form lay-filter="makeOrderDetailForm" class="layui-form">
                <div class="layui-form-item" style="margin-bottom: 10px;">
                    <div class="open-details-title">制造令信息</div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">制造令编号</label>
                        <div class="layui-input-block"  style="margin-left: 135px; width: 70%">
                            <input name="code" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">排产记录编号</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="productionPlanRecordCode" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">计划编号</label>
                        <div class="layui-input-block"  style="margin-left: 135px; width: 70%">
                            <input name="planCode" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">产品料号</label>
                        <div class="layui-input-block"  style="margin-left: 135px; width: 70%">
                            <input name="skuCode" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">排产工序</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="processName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">工站</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="deviceName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">计划数量</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="planProductionQuantity" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">排产数量</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="outputQuantity" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">计划类型</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="planTypeName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">编制人</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="creatorName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">排产日期</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="createTime" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
            </form>
            <!-- 产品信息 -->
            <form lay-filter="productionForm" class="layui-form model-form">
                <div class="layui-form-item" style="margin-bottom: 10px;">
                    <div class="open-details-title">产品信息</div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">产品类别</label>
                        <div class="layui-input-block"  style="margin-left: 135px; width: 70%">
                            <input name="productTypeName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">产品性质</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="productNatureName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">是否关联新料号</label>
                        <div class="layui-input-block"  style="margin-left: 135px; width: 70%">
                            <input name="isUseOrAdd" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">内部SKU号</label>
                        <div class="layui-input-block"  style="margin-left: 135px; width: 70%">
                            <input name="inSkuCode" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">内部SKU名称</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="inSkuName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">产品属性</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="assemblyNatureName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">内部规格码</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="inSkuSpec" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">计量单位</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="inSkuUnitName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">基础单位</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="inUnitName" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-col-xs4">
                    <div class="layui-form-item">
                        <label class="layui-form-label" style="width: 100px;">基础单位数量</label>
                        <div class="layui-input-block" style="margin-left: 135px; width: 70%">
                            <input name="inUnitCount" class="layui-input" type="text" readonly="readonly"/>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-row" style="margin-left: 15px;">
                    <div class="layui-col-md4">
                        <div style="margin: 5px">
                            <div style="background-color: #fff;padding: 20px;text-align: center; border: 1px solid #E6E6E6;font-size: 14px;">图纸</div>
                            <div id="drawShow" style="height: 100%;"></div>
                        </div>
                    </div>
                    <div class="layui-col-md8">
                        <div class="layui-form-item layui-row">
                            <div style="margin: 5px">
                                <div style="background-color: #fff;padding: 20px;text-align: center;border: 1px solid #E6E6E6;font-size: 14px;">质检标准</div>
                                <table class="layui-table" id="testItemTable" lay-filter="testItemTable" style="margin: 0px !important;"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>


<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'admin', 'layedit'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var admin = layui.admin;
        var layedit = layui.layedit;
        var upload = layui.upload;

        const nowData = { ...parentData };
        // 制造令信息回显
        var makeOrderDetailData = admin.getTempData('makeOrderDetail');
        form.val("makeOrderDetailForm",makeOrderDetailData);
        form.render();
        // 产品信息
        admin.req('enterprise/res/admin/planning/proTask/detail', {
            skuCode: makeOrderDetailData.skuCode
        }, function (res) {
            if (res.code == 200) {
                //产品信息回显
                form.val("productionForm", res.data);
                form.render();
                //图纸回显
                let imagUrl = res.data.attachmentPdfUrl;
                if (imagUrl && imagUrl.indexOf(".pdf") !== -1) {
                    PDFObject.embed(imagUrl, "#drawShow");
                } else {
                    let attachmentHtml = "";
                    imagUrl.split(",").forEach((attachmentUrl, index) => {
                        attachmentHtml += '<div><div><img style="max-width: 100%" src="' + attachmentUrl + '"></div></div>';
                    });
                    $('#drawShow').html(attachmentHtml);
                }
                //质检标准回显
                admin.req('enterprise/quality/admin/qualityTemplate/getQualityInfoBY/'+makeOrderDetailData.bookId, {}, function (response) {
                    table.render({
                        elem: '#testItemTable',
                        data: response.data,
                        id: 'testItemTable',
                        limit: 9999,
                        cols: [
                            [
                                { type: 'numbers', title: '序号' },
                                {
                                    field: 'name',

                                    align: 'center',
                                    title: '检查项',
                                    templet: admin.setTableInput('name', nowData.eventName === 'detail', 'name'),
                                },
                                { field: 'standard', sort: true, title: '标准', templet: admin.setTableInput('standard', nowData.eventName === 'detail', 'standard') },
                                { field: 'utensil', sort: true, title: '器具', templet: admin.setTableInput('utensil', nowData.eventName === 'detail', 'utensil') },
                                { field: 'way', sort: true, title: '方法', templet: admin.setTableInput('way', nowData.eventName === 'detail', 'way') },
                                { field: 'importance', sort: true, title: '重要程度', templet: admin.setTableInput('importance', nowData.eventName === 'detail', 'importance') },
                                { field: 'detectionRate', sort: true, title: '检测率', templet: admin.setTableInput('detectionRate', nowData.eventName === 'detail', 'detectionRate') },
                            ],
                        ],
                        done: function () {
                            admin.tableInputChange('testItemTable');
                        },
                    });
                })

            } else {
                layer.msg(res.msg, {icon: 2});
            }
        }, 'GET');
    });
</script>